﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.OleDb;

namespace WebApplication16
{
    internal sealed class DataLayer
    {
        private DataSet dataSetData;
        public DataLayer(string connStr, string productSql)
        {
            LoadDataToDataSet(connStr, productSql);
        }

        public DataSet DataSetData
        {
            get { return dataSetData; }
        }

        private void LoadDataToDataSet(string connStr, string productSql)
        {
            dataSetData = new DataSet();
            OleDbConnection conn = new OleDbConnection(connStr);
            OleDbCommand cmd = new OleDbCommand(productSql, conn);
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            adapter.SelectCommand = cmd;
            adapter.Fill(dataSetData, "Products");
        }
    }
}